#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    //把按钮的clicked信号关联mybutton_fun槽函数
    connect(ui->button,&QPushButton::clicked,this,&MainWindow::mybutton_fun);

    //把mysignal信号与selfbutton_fun槽函数关联
    connect(this,&MainWindow::mysignal,this,&MainWindow::selfbutton_fun);


}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::mybutton_fun()
{
    qDebug()<<"槽函数1";
    //发送信号-----
    emit mysignal();
}

void MainWindow::selfbutton_fun()
{
    qDebug()<<"槽函数2";
}
